package com.gengzp.ops.facade.impl;

import com.gengzp.common.exception.BusinessException;
import com.gengzp.common.model.database.entity.SysDatabase;
import com.gengzp.ops.facade.ISysDatabaseFacadeService;
import com.gengzp.ops.mapper.SysDatabaseMapper;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName SysDatabaseFacadeServiceImpl
 * @Description 系统数据库服务门面层实现类
 * @Author gengzp
 * @Date 2025/7/8 13:49
 */
@Service
public class SysDatabaseFacadeServiceImpl implements ISysDatabaseFacadeService {

    @Autowired
    private SysDatabaseMapper sysDatabaseMapper;

    private static final Logger logger = LoggerFactory.getLogger(SysDatabaseFacadeServiceImpl.class);

    @Override
    public SysDatabase searchSysDatabaseByDatabaseCode(String databaseCode) {
        if (StringUtils.isBlank(databaseCode)) {
            throw BusinessException.get("数据库编码 databaseCode 不能为空");
        }

        return sysDatabaseMapper.selectByDatabaseCode(databaseCode);
    }

}
